package com.cheng.example.book.advise151.chap3;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Client48 {

    public static void main(String[] args) {
        // Person类的实例作为map的key
        Map<Person, Object> map = new HashMap<Person, Object>() {

            {
                put(new Person("张三"), new Object());
            }
        };
        // Person类的实例作为List的元素
        List<Person> list = new ArrayList<Person>() {
            {
                add(new Person("张三"));
            }
        };
        boolean b1 = list.contains(new Person("张三"));
        boolean b2 = map.containsKey(new Person("张三"));
        System.out.println(b1);
        System.out.println(b2);

    }
}